package cn.itsource.ymcc.doc;

import com.baomidou.mybatisplus.annotations.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

@Document(indexName = "ymcc", type = "course")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseDoc {

    @Id
    private Long id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String name;
    /**
     * 适用人群
     */
    private String forUser;
    /**
     * 课程分类
     */
    private Long courseTypeId;

    @Field(type = FieldType.Keyword)
    private String gradeName;
    /**
     * 课程等级
     */
    private Long gradeId;


    private Date startTime;
    /**
     * 课程的节课时间
     */
    private Date endTime;
    /**
     * 封面，云存储地址
     */
    @Field(type = FieldType.Keyword)
    private String pic;
    /**
     * 时长，以分钟为单位
     */
    @Field(type = FieldType.Integer)
    private Integer totalMinute;

    private Date onlineTime;
    /**
     * 章节数
     */
    @Field(type = FieldType.Integer)
    private Integer chapterCount;
    /**
     * 讲师，逗号分隔多个
     */
    @Field(type = FieldType.Keyword)
    private String teacherNames;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String description;
    /**
     * 简介
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String intro;

    /**
     * 收费规则：，收费1免费，2收费
     */
    @Field(type = FieldType.Integer)
    private Integer charge;
    /**
     * 咨询qq
     */
    @Field(type = FieldType.Keyword)
    private String qq;
    /**
     * 价格
     */
    @Field(type = FieldType.Double)
    private BigDecimal price;
    /**
     * 原价
     */
    @Field(type = FieldType.Double)
    @TableField("price_old")
    private BigDecimal priceOld;

    @Field(type = FieldType.Integer)
    @TableField("valid_days")
    private Integer validDays;
}
